package com.work.cos.domain.vo;

import org.apache.shiro.authc.UsernamePasswordToken;

import com.work.cos.domain.entity.sys.SysUserEntity;

/**
 * 类功能说明：shiro扩展Token
 * 
 * @see UsernamePasswordToken
 */
public class ComUserToken extends UsernamePasswordToken
{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1337621987786356870L;

	/**
	 * 要登录指向的系统
	 * {@link cc.giveme5.domain.entity.ComRoleEntity.COM_USER_TYPE}
	 */
	private int 				 userType;

	/**
	 * 远程认证
	 */
	private boolean				 remoteLogin =false;

    /**
     * 用户信息， 远程认证 专用
     */
    private SysUserEntity        user;


    /**
     * 普通登陆
     * @param username
     * @param password
     * @param userType
     * @param rememberMe
     * @param isRemoteLogin
     */
	public ComUserToken(final String username, final String password, final int userType, final boolean rememberMe, final boolean isRemoteLogin)
	{
		super.setUsername(username);
		super.setHost(null);
		super.setRememberMe(rememberMe);
		super.setPassword(password != null ? password.toCharArray() : null);
		this.userType = userType;
        this.remoteLogin = isRemoteLogin;
	}


    /**
     * 远程登陆
     * @param username
     * @param password
     * @param userType
     * @param rememberMe
     * @param isRemoteLogin
     * @param user
     */
    public ComUserToken(final String username, final String password, final int userType, final boolean rememberMe, final boolean isRemoteLogin, final SysUserEntity user)
    {
        super.setUsername(username);
        super.setHost(null);
        super.setRememberMe(rememberMe);
        super.setPassword(password != null ? password.toCharArray() : null);
        this.userType = userType;
        this.remoteLogin = isRemoteLogin;
        this.user = user;
    }


	public int getUserType() {
		return userType;
	}

	public void setUserType(int userType) {
		this.userType = userType;
	}

    public boolean isRemoteLogin() {
        return remoteLogin;
    }

    public void setRemoteLogin(boolean remoteLogin) {
        this.remoteLogin = remoteLogin;
    }

    public SysUserEntity getUser() {
        return user;
    }

    public void setUser(SysUserEntity user) {
        this.user = user;
    }
}
